#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int MiniStep(int x);

int main(void)
{
    int n, ans;

    while (scanf("%d", &n) != -1)
    {


        ans = MiniStep(n);

        printf("%d\n", ans);
    }

    return 0;

}

int MiniStep(int x)
{
    int jackpot;
    if (x == 1)
        jackpot = 2;
    else
        jackpot = MiniStep(x - 1) * 3 + 2;

    return jackpot;

}